﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;

public class PublishConfig {

    private class PublishConfigData
    {
        public string productName;
        public string productPushlishFolderName;
        public string productVersion;
        public int revisonBase;
        public List<string> folderToCopy;
        public List<string> fileToCopy;
    }

    private string filePath = "/Editor/PublishConfig/config.txt";

    private static PublishConfig instance = null;

    private PublishConfigData publishConfigData = null;

    public static PublishConfig Instance()
    {
        if (instance == null)
        {
            instance = new PublishConfig();
        }

        return instance;
    }

    public bool Init()
    {
        string path = Application.dataPath + filePath;
        string fileContent = File.ReadAllText(path);
        publishConfigData = JsonUtility.FromJson<PublishConfigData>(fileContent);
        return true;
    }

    public string GetProductPublishFolder()
    {
        return publishConfigData.productPushlishFolderName;
    }

    public string GetVersion()
    {
        return publishConfigData.productVersion;
    }

    public string GetProductName()
    {
        return publishConfigData.productName;
    }

    public int GetRevisionBase()
    {
        return publishConfigData.revisonBase;
    }
}
